<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<link href="../css/header.css" rel="stylesheet" />

	</head>

	<body>
		<!--头部标题栏 -->
		<header class="mui-bar mui-bar-nav title">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left title-color"></a>
			<h1 class="mui-title title-color"><b>资料设置</b></h1>
		</header>


		<!-- 主体部分 -->
		<div class="mui-content">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media">
					<a href="javascript:;" id="link_myface">
						<span class="mui-icon mui-icon-arrowright mui-pull-right"
							style="line-height: 42px;color: dimgray;margin-left: 3px;"></span>
						<span id="span_nickname" class="mui-pull-right"
							style="line-height: 42px;color: dimgray;font-size: 16px;">千言</span>
						<div class="mui-media-body font-style">
							用户名
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a id="link_nickname" href="javascript:;">
						<span class="mui-icon mui-icon-arrowright mui-pull-right"
							style="line-height: 42px;color: dimgray;margin-left: 3px;"></span>
						<div class="mui-media-body font-style">
							朋友权限
						</div>
					</a>
				</li>
			</ul>


			<ul class="mui-table-view" style="margin-top: 10px;">
				<li class="mui-table-view-cell mui-media">
					<a id="link_my_qrcode" href="javascript:;">
						<div class="mui-media-body font-style">
							设为星标朋友
						</div>
						<div class="mui-switch mui-switch-mini">
							<div class="mui-switch-handle">
							</div>
						</div>
					</a>
				</li>
			</ul>
			<ul class="mui-table-view" style="margin-top: 10px;">
				<li class="mui-table-view-cell mui-media">
					<a id="link_my_qrcode" href="javascript:;">
						<div class="mui-media-body font-style">
							加入黑名单
						</div>
						<div class="mui-switch mui-switch-mini">
							<div class="mui-switch-handle">
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a id="link_my_qrcode" href="javascript:;">
						<span class="mui-icon mui-icon-arrowright mui-pull-right"
							style="line-height: 42px;color: dimgray;margin-left: 3px;"></span>
						<div class="mui-media-body font-style">
							投诉
						</div>
					</a>
				</li>
			</ul>
			<br />
			<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media">
					<a id="link_delete" href="javascript:;">
						<div class="mui-media-body font-style" style="text-align: center;color: red;">
							删除联系人
						</div>
					</a>
				</li>
			</ul>
		</div>







		<script src="../js/mui.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function() {
				var friendUserId;
				var friendNickname;

				//获取当前webview对象，并且刷新当前登录的用户信息
				var currentWebview = plus.webview.currentWebview();
				friendNickname = currentWebview.friendNickname;
				friendUserId = currentWebview.friendUserId;
				//设置聊天页面的标题栏好友昵称
				document.getElementById("span_nickname").innerHTML = friendNickname;


				//添加自定义事件，刷新头像及个人信息
				window.addEventListener("refresh", function() {

				});

				//昵称
				document.getElementById("link_nickname").addEventListener("tap", function() {

				});

				//删除联系人
				var link_delete = document.getElementById("link_delete");
				link_delete.addEventListener("tap", function() {
					var user = app.getUserGlobalInfo();
					mui.ajax(app.serverUrl + "/user/deleteFriendId?myUserId=" + user.id + '&myFriendUserId=' +
						friendUserId, {
							type: 'post',
							timeout: 10000,
							success: function(data) {
								if (data.status == 200) {

									//删除提示
									app.showToast("删除好友成功");
									//刷新通讯录的好友缓存
									var myfaceWebview1 = plus.webview.getWebviewById("bird-contact.html");
									myfaceWebview1.evalJS("aaaaa()");
									
									var myfaceWebview = plus.webview.getWebviewById("bird-contact.html");
									mui.fire(myfaceWebview, "show");
									
								
									//调用聊天列表页面删除好友后删除聊天记录
									var webview = plus.webview.getWebviewById("bird-chatlist.html");
									webview.evalJS("delecs('" + friendUserId + "')");

									var cPage = plus.webview.currentWebview();
									var bPage = cPage.opener();


									bPage.close();
									cPage.close();


									var wvs = plus.webview.all();
									//关闭聊天页面
									plus.webview.close(wvs[6]);





								} else {
									app.showToast(data.msg, "error");
								}

							},
							error: function(e) {
								console.log(e);
							}
						});







				});

			});
		</script>
	</body>

</html>
